/*
 * @FilePath: \undefinedc:\Users\sxjct\.leetcode\179.最大数.cpp
 * @Brief: 
 * @Version: 1.0
 * @Date: 2021-04-12 13:33:23
 * @Author: tianyiyi
 * @Copyright: Copyright@tianyiyi
 * @LastEditors: Mr.Tian
 * @LastEditTime: 2021-04-12 15:10:04
 */
/*
 * @lc app=leetcode.cn id=179 lang=cpp
 *
 * [179] 最大数
 */

// @lc code=start
class Solution {
public:
    string largestNumber(vector<int>& nums) {
        vector<string> int2str;
        string res;
        for(i : nums)
        {
            int2str.push_back(to_string(i));
        }
        sort(int2str.begin(),int2str.end(),[](string &str1,string str2){return str1 + str2 > str2 + str1;});
    
        if(int2str[0] == "0")
            return "0";
        for(string s : int2str)
            res += s;
        return res;
    
    }
};
// @lc code=end

